﻿@model SpiderArticle
@{
    ViewBag.Title = "审核新闻";
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}
<h2>@Model.Title</h2>

<div>
    @Html.Sanitized(Model.Content)
</div>

@using (Html.BeginForm("SpiderVerify", "Admin", FormMethod.Post))
{
    @Html.AntiForgeryToken()
    <input type="hidden" id="Operation" name="Operation" />
    <input type="hidden" id="id" name="id" value="@Model.ID" />
    <br />
    <br />
    <p>
        <select id="lvl1">
            @foreach (TypeDictionary td in ViewBag.Level1)
            {
                <option value="@td.ID">@td.TypeValue</option>
            }
        </select>
        <select id="lvl2" data-parent-select="lvl1" name="TypeID">
            @foreach (TypeDictionary td in ViewBag.Level2)
            {
                <option data-parent-id="@td.FatherID" value="@td.ID">@td.TypeValue</option>
            }
        </select>
		<a href="/Admin/AddType?type=新闻" class="btn btn-deflaut" id="add_new_type">增加新闻分类</a>
        <a href="javascript: Accept()" class="btn btn-success">录入新闻</a>
        <a href="javascript: Reject()" class="btn btn-danger">删除新闻</a>
    </p>
}
<script>
    function Accept() {
        $('#Operation').val('Accept');
		if($("#lvl2").val()==null)
		{
			CastMsg("请选择新闻分类");
			return false;
		}
		else
		{
			$('form').submit();
			return true;
		}
    }
    function Reject() {
        $('#Operation').val('Reject');
        $('form').submit();
    }
	$("#lvl2").change(function(){
		if($("#lvl2").val()!="")
		{
			$("#add_new_type").hide();
		}
		else
		{
			$("#add_new_type").show();
		}
	});
</script>